package com.rushswise.lovetrip;

import com.rushswise.lovetrip.gps.OpenGpsBtnClickListener;

import android.os.Bundle;
import android.app.Activity;
import android.content.ContentResolver;
import android.util.Log;
import android.view.Menu;
import android.view.View;

public class LoveTripMainActivity extends Activity {

    private static ContentResolver contentResolver = null;
    
    private static Activity currActivity = null;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_love_trip_main);
        
        contentResolver = getContentResolver();
        currActivity    = this;
        
        //添加按钮事件
        addBtnEvent(savedInstanceState);
    }
    
    /**
      * 添加单击时间监听器
      *
      * @Title: addBtnEvent
      * @Description: TODO
      * @param @param savedInstanceState
      * @return void
      * @throws
      */
    private void addBtnEvent(Bundle savedInstanceState)
    {
        View btnView = this.findViewById(R.id.button1);
        btnView.setOnClickListener(new OpenGpsBtnClickListener(this));
        
    }

    /**
      * Get current Activity in system
      *
      * @Title: getCurrActivity
      * @Description: TODO
      * @param @return
      * @return Activity
      * @throws
      */
    public static Activity getCurrActivity()
    {
        return currActivity;
    }

    /**
      * Obtain ContentResolver instance.
      *
      * @Title: obtaionContentResolver
      * @Description: TODO
      * @param @return
      * @return ContentResolver
      * @throws
      */
    public static ContentResolver obtainContentResolver()
    {
        if(null == contentResolver)
        {
            Log.v("Error", "contentResolver is null");
        }
        return contentResolver;
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.love_trip_main, menu);
        return true;
    }


}
